fix: #401 use (SOL) notation to prevent USD/coin amount confusion#402
fix: #401 use (SOL) notation to prevent USD/coin amount confusion#402nxz1026 wants to merge 2 commits into
Conversation
Greptile SummaryThis PR changes the bounty coin notation from
Confidence Score: 3/5The min===max branch now renders a double space between the USD amount and the coin tag, and the accompanying test would catch this — meaning the test itself would fail when run. The extra '" " + coinNote' in the equal-budget branch doubles the leading space that coinNote already includes, producing '$1.00 USD (SOL)' instead of '$1.00 USD (SOL)'. The new test asserts the single-space format and would break against this code, so the fix is both functionally wrong and unverified by its own test suite. src/components/gigs/GigCard.tsx line 80 — the double-space concatenation in the equal min/max branch needs to be corrected before merging. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[getBudgetDisplay] --> B{budget_type === revenue_share?}
B -- yes --> C[return rev share string]
B -- no --> D{min && max && min !== max?}
D -- yes --> E["fmt(min) - fmt(max) + suffix + coinNote"]
D -- no --> F{min && max?}
F -- yes --> G["fmt(min) + suffix + ' ' + coinNote ⚠️ double space"]
F -- no --> H{min only?}
H -- yes --> I["fmt(min)+ + suffix + coinNote"]
H -- no --> J{max only?}
J -- yes --> K["up to fmt(max) + suffix + coinNote"]
J -- no --> L[Budget TBD / Rate TBD]
style G fill:#f88,stroke:#c00,color:#000
Reviews (1): Last reviewed commit: "fix: apply DeepSeek review suggestions —..." | Re-trigger Greptile |
|
|
||
| if (min && max && min !== max) return `${fmt(min)} - ${fmt(max)}${suffix}${!isSats ? coinNote : ""}`; | ||
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`; | ||
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`; |
There was a problem hiding this comment.
Double space in equal min/max branch
coinNote is already defined with a leading space ( (${coin})), so prepending " " + coinNote yields " (SOL)" — two spaces — for the min === max path. The rendered text becomes $1.00 USD (SOL) instead of $1.00 USD (SOL). The new test asserts the single-space pattern /\$1\.00 USD \(SOL\)/ and would fail with this implementation.
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? " " + coinNote : ""}`; | |
| if (min && max) return `${fmt(min)}${suffix}${!isSats ? coinNote : ""}`; |
| // Use ~ prefix when paying in crypto so readers don't mistake USD value for coin amount | ||
| // e.g. "$1.00 USD (~SOL)" not "$1.00 USD (paid in SOL)" — ~ makes it clear it's an equivalent | ||
| const coinNote = coin ? ` (${coin})` : ""; |
There was a problem hiding this comment.
The comment says the format uses a
~ prefix (e.g., "$1.00 USD (~SOL)"), but the code produces (SOL) without any tilde. The comment misleads future readers about the actual output format.
| // Use ~ prefix when paying in crypto so readers don't mistake USD value for coin amount | |
| // e.g. "$1.00 USD (~SOL)" not "$1.00 USD (paid in SOL)" — ~ makes it clear it's an equivalent | |
| const coinNote = coin ? ` (${coin})` : ""; | |
| // Append "(COIN)" so readers don't mistake the USD value for a coin amount | |
| // e.g. "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" | |
| const coinNote = coin ? ` (${coin})` : ""; |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| poster: mockPoster, | ||
| }; | ||
| render(<GigCard gig={gig} />); | ||
| // Should show "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" — (SOL) not (~SOL) |
There was a problem hiding this comment.
The inline comment says
(SOL) not (~SOL) but the code comments in GigCard.tsx state the opposite — that ~ prefix is used. With the stale ~ comment removed from the source, the test comment should simply describe the expected format clearly.
| // Should show "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" — (SOL) not (~SOL) | |
| // Should show "$1.00 USD (SOL)" not "$1.00 USD (paid in SOL)" |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
fixed |
Bounty Claim: #401
Amount: $1
Repo: profullstack/ugig.net
Problem
When
payment_coinis set (e.g. SOL), the bounty display reads "$1.00 USD (paid in SOL)" — readers easily mistake this for "1 SOL" worth ~$1000.Fix
Changed
(paid in SOL)→(SOL)with a leading space for proper token separation. Also fixed missing space before coin note in the equal-min/max branch.GigCard.tsx: change(paid in ${coin})to(${coin}), add space before coin note in equal-min/max caseGigCard.test.tsx: add test verifying$1.00 USD (SOL)display/bounty